<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<!-- Copyright (C) 1988-2017 Free Software Foundation, Inc.

Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3 or
any later version published by the Free Software Foundation; with the
Invariant Sections being "Free Software" and "Free Software Needs
Free Documentation", with the Front-Cover Texts being "A GNU Manual,"
and with the Back-Cover Texts as in (a) below.

(a) The FSF's Back-Cover Text is: "You are free to copy and modify
this GNU Manual.  Buying copies from GNU Press supports the FSF in
developing GNU and promoting software freedom." -->
<!-- Created by GNU Texinfo 5.2, http://www.gnu.org/software/texinfo/ -->
<head>
<title>Debugging with GDB: Ada Glitches</title>

<meta name="description" content="Debugging with GDB: Ada Glitches">
<meta name="keywords" content="Debugging with GDB: Ada Glitches">
<meta name="resource-type" content="document">
<meta name="distribution" content="global">
<meta name="Generator" content="makeinfo">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link href="index.html#Top" rel="start" title="Top">
<link href="Concept-Index.html#Concept-Index" rel="index" title="Concept Index">
<link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
<link href="Ada.html#Ada" rel="up" title="Ada">
<link href="Unsupported-Languages.html#Unsupported-Languages" rel="next" title="Unsupported Languages">
<link href="Ravenscar-Profile.html#Ravenscar-Profile" rel="prev" title="Ravenscar Profile">
<style type="text/css">
<!--
a.summary-letter {text-decoration: none}
blockquote.smallquotation {font-size: smaller}
div.display {margin-left: 3.2em}
div.example {margin-left: 3.2em}
div.indentedblock {margin-left: 3.2em}
div.lisp {margin-left: 3.2em}
div.smalldisplay {margin-left: 3.2em}
div.smallexample {margin-left: 3.2em}
div.smallindentedblock {margin-left: 3.2em; font-size: smaller}
div.smalllisp {margin-left: 3.2em}
kbd {font-style:oblique}
pre.display {font-family: inherit}
pre.format {font-family: inherit}
pre.menu-comment {font-family: serif}
pre.menu-preformatted {font-family: serif}
pre.smalldisplay {font-family: inherit; font-size: smaller}
pre.smallexample {font-size: smaller}
pre.smallformat {font-family: inherit; font-size: smaller}
pre.smalllisp {font-size: smaller}
span.nocodebreak {white-space:nowrap}
span.nolinebreak {white-space:nowrap}
span.roman {font-family:serif; font-weight:normal}
span.sansserif {font-family:sans-serif; font-weight:normal}
ul.no-bullet {list-style: none}
-->
</style>


</head>

<body lang="en" bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#800080" alink="#FF0000">
<a name="Ada-Glitches"></a>
<div class="header">
<p>
Previous: <a href="Ravenscar-Profile.html#Ravenscar-Profile" accesskey="p" rel="prev">Ravenscar Profile</a>, Up: <a href="Ada.html#Ada" accesskey="u" rel="up">Ada</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Concept-Index.html#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>
<hr>
<a name="Known-Peculiarities-of-Ada-Mode"></a>
<h4 class="subsubsection">15.4.10.10 Known Peculiarities of Ada Mode</h4>
<a name="index-Ada_002c-problems"></a>

<p>Besides the omissions listed previously (see <a href="Omissions-from-Ada.html#Omissions-from-Ada">Omissions from Ada</a>),
we know of several problems with and limitations of Ada mode in
<small>GDB</small>,
some of which will be fixed with planned future releases of the debugger 
and the GNU Ada compiler.
</p>
<ul>
<li> Static constants that the compiler chooses not to materialize as objects in 
storage are invisible to the debugger.

</li><li> Named parameter associations in function argument lists are ignored (the
argument lists are treated as positional).

</li><li> Many useful library packages are currently invisible to the debugger.

</li><li> Fixed-point arithmetic, conversions, input, and output is carried out using 
floating-point arithmetic, and may give results that only approximate those on 
the host machine.

</li><li> The GNAT compiler never generates the prefix <code>Standard</code> for any of 
the standard symbols defined by the Ada language.  <small>GDB</small> knows about 
this: it will strip the prefix from names when you use it, and will never
look for a name you have so qualified among local symbols, nor match against
symbols in other packages or subprograms.  If you have 
defined entities anywhere in your program other than parameters and 
local variables whose simple names match names in <code>Standard</code>, 
GNAT&rsquo;s lack of qualification here can cause confusion.  When this happens,
you can usually resolve the confusion 
by qualifying the problematic names with package
<code>Standard</code> explicitly.  
</li></ul>

<p>Older versions of the compiler sometimes generate erroneous debugging
information, resulting in the debugger incorrectly printing the value
of affected entities.  In some cases, the debugger is able to work
around an issue automatically. In other cases, the debugger is able
to work around the issue, but the work-around has to be specifically
enabled.
</p>
<a name="index-set-ada-trust_002dPAD_002dover_002dXVS"></a>
<a name="index-show-ada-trust_002dPAD_002dover_002dXVS"></a>
<dl compact="compact">
<dt><code>set ada trust-PAD-over-XVS on</code></dt>
<dd><p>Configure GDB to strictly follow the GNAT encoding when computing the
value of Ada entities, particularly when <code>PAD</code> and <code>PAD___XVS</code>
types are involved (see <code>ada/exp_dbug.ads</code> in the GCC sources for
a complete description of the encoding used by the GNAT compiler).
This is the default.
</p>
</dd>
<dt><code>set ada trust-PAD-over-XVS off</code></dt>
<dd><p>This is related to the encoding using by the GNAT compiler.  If <small>GDB</small>
sometimes prints the wrong value for certain entities, changing <code>ada
trust-PAD-over-XVS</code> to <code>off</code> activates a work-around which may fix
the issue.  It is always safe to set <code>ada trust-PAD-over-XVS</code> to
<code>off</code>, but this incurs a slight performance penalty, so it is
recommended to leave this setting to <code>on</code> unless necessary.
</p>
</dd>
</dl>

<a name="index-GNAT-descriptive-types"></a>
<a name="index-GNAT-encoding"></a>
<p>Internally, the debugger also relies on the compiler following a number
of conventions known as the &lsquo;<samp>GNAT Encoding</samp>&rsquo;, all documented in
<samp>gcc/ada/exp_dbug.ads</samp> in the GCC sources. This encoding describes
how the debugging information should be generated for certain types.
In particular, this convention makes use of <em>descriptive types</em>,
which are artificial types generated purely to help the debugger.
</p>
<p>These encodings were defined at a time when the debugging information
format used was not powerful enough to describe some of the more complex
types available in Ada.  Since DWARF allows us to express nearly all
Ada features, the long-term goal is to slowly replace these descriptive
types by their pure DWARF equivalent.  To facilitate that transition,
a new maintenance option is available to force the debugger to ignore
those descriptive types.  It allows the user to quickly evaluate how
well <small>GDB</small> works without them.
</p>
<dl compact="compact">
<dd>
<a name="index-maint-ada-set-ignore_002ddescriptive_002dtypes"></a>
</dd>
<dt><code>maintenance ada set ignore-descriptive-types [on|off]</code></dt>
<dd><p>Control whether the debugger should ignore descriptive types.
The default is not to ignore descriptives types (<code>off</code>).
</p>
<a name="index-maint-ada-show-ignore_002ddescriptive_002dtypes"></a>
</dd>
<dt><code>maintenance ada show ignore-descriptive-types</code></dt>
<dd><p>Show if descriptive types are ignored by <small>GDB</small>.
</p>
</dd>
</dl>

<hr>
<div class="header">
<p>
Previous: <a href="Ravenscar-Profile.html#Ravenscar-Profile" accesskey="p" rel="prev">Ravenscar Profile</a>, Up: <a href="Ada.html#Ada" accesskey="u" rel="up">Ada</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Concept-Index.html#Concept-Index" title="Index" rel="index">Index</a>]</p>
</div>



</body>
</html>
